<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/12/2
 * Time: 14:20
 */
namespace App\Modules;
use Illuminate\Database\Eloquent\Model;
use DB;
class EntMemberInfo extends Model {
/**
     * 关联到模型的数据表
     *
     * @var string
     */
    protected $table = 'MemberInfo';
    /**
     * 主键
     * @var unknown
     */
    protected $primaryKey='UserID';
    /**
     * Eloquent 期望数据表中存在 created_at 和 updated_at 字段。
     * 
     * @var unknown
     */
    public  $timestamps = false;


    /*
     * 获得用户信息
     * @param userId 用户ID
     * @return 用户信息
     * */
    public function get_member_info_by_id($userId){
        $colum = ['UserID','States', 'MemEndTime', 'FilePath1', 'YourName', 'MemNumber'];
        $memberInfo = $this->select($colum)
            ->where('DeleteMark', '1')
            ->where('UserID', $userId)
            ->first();

        if(count($memberInfo) == 1){
            return $memberInfo;
        }
        return false;
    }






    /*
     * 根据手机号和APP key获取用户信息
     * @param mobile 手机号
     * @param appKey app设备ID
     * */
    public function get_member_info_by_mobile_and_appkey($mobile,$appKey){
        $colum = ['UserID', 'States', 'MemEndTime', 'FilePath1', 'YourName', 'MemNumber'];
        $memberInfo = $this->select($colum)
            ->where('DeleteMark', '1')
            ->where('UserName', $mobile)
            ->where('AppKey', $appKey)
            ->first();
        if(count($memberInfo) == 1){
            return $memberInfo;
        }
        return false;
    }













}